<?php
	class cms_menu_widget extends Widget 
	{
		public function display($args)
		{
			//$CI =& get_instance();
			$totalmenu=$this->general_model->select("menu");
			$treelist=array();
			foreach($totalmenu as $menu)
			{
				if($menu['menu_name']==$args['menu_name'])
				{
					$menulist =$this->general_model->get_jointable("menu_items","pages","menu_items.*,pages.slug,pages.title","menu_items.pageid=pages.pageid","menu_items.menu_id ='".$menu['menu_id']."' order by menu_items.sort_order asc");
					
					$treelist =get_nested($menulist);
					/*echo "<pre>";
					print_r($treelist);*/
					//$data['tree']=list_admin_nav($data['treelist']);
				}
			}
			$data=array('menu_name'=>$args['menu_name'],'liaclass'=>$args['liaclass'],'menu'=>$treelist);
			//echo "<pre>";
			//print_r($data);
			
			$this->load->view('widgets/cmsmenu', $data);	
		}
	}
?>